/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package stis.statpro.ibs.datasource;

import com.mysql.jdbc.jdbc2.optional.MysqlDataSource;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author habib <imamhabibpamungkas@gmail.com>
 */
public class Datasource {
    
    private static Connection conn;

    public static Connection getConnection() throws SQLException{
        if(conn==null){
            MysqlDataSource dataSource = new MysqlDataSource();
            dataSource.setURL("jdbc:mysql://localhost:3306/ibs");
            dataSource.setUser("root");
            dataSource.setPassword(null);
            
            conn = dataSource.getConnection();
        }
        return conn;
    }
}
